package com.anxin.registerManagement.util;

import cn.hutool.crypto.digest.MD5;

import java.nio.charset.StandardCharsets;

/**
 * @author anxin
 * @date 2022/4/6 18:49
 */
public class Md5Util {

    /**
     * md5加密，不加盐
     */
    public static String getMd5Str(String str) {
        MD5 md5 = MD5.create();
        return md5.digestHex(str);
    }

    /**
     * md5加密，加盐
     */
    public static String getMd5Str(String str, String salt) {
        MD5 md5 = MD5.create();
        md5.setSalt(salt.getBytes(StandardCharsets.UTF_8));
        return md5.digestHex(str);
    }

}
